import { IsNotEmpty, Matches, IsOptional } from 'class-validator';
import { regPositive } from 'src/utils/regex.util';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
export class ArticleEditDTO {
  @ApiProperty({ description: '文章id' })
  @Matches(regPositive, { message: 'id必须为正数且不小于0' })
  @IsNotEmpty({ message: 'id不能为空' })
  id: number;

  @ApiPropertyOptional({
    description: '文章标题',
    example: '啊！美丽的大海',
    required: false,
  })
  @IsOptional()
  readonly title?: string;

  @ApiProperty({
    description: '文章描述/简介',
    example: '给你讲述美丽的大海',
    required: false,
  })
  @IsOptional()
  readonly description?: string;

  @ApiProperty({
    description: '文章内容',
    example: '啊！美丽的大海，你是如此美丽',
    required: false,
  })
  @IsOptional()
  readonly content?: string;
}
